package lt.marsrutai.mobile.android.map.overlay;

import java.text.SimpleDateFormat;

import lt.marsrutai.mobile.android.activity.FastestRoutesResultMapActivity.RouteNode;
import lt.marsrutai.mobile.android.model.SegmentPoint;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;

/**
 * Overlay item 
 * 
 * @author Justas
 */
public class RoutePointOverlayItem extends OverlayItem {

    private RouteNode routeNode;
    private String scopeFolder;
    
    public RoutePointOverlayItem(GeoPoint geoPoint, RouteNode routeNode, String scopeFolder) {
        super(geoPoint, null, null);
        this.routeNode = routeNode;
        this.scopeFolder = scopeFolder;
    }

    @Override
    public String getTitle() {
        SegmentPoint point = routeNode.getPoint();
        String title = point.getStopId() != null ? point.getStopName() : routeNode.getAlternativeName();
        return String.format("%s (%s)", title, new SimpleDateFormat("HH:mm").format(point.getTime().getTime()));
    }
    
    @Override
    public String getSnippet() {
        SegmentPoint point = routeNode.getPoint();
        return point.getStopId() != null ? point.getStopDirectionName() : null;
    }

    public String getScopeFolder() {
        return scopeFolder;
    }

    public void setScopeFolder(String scopeFolder) {
        this.scopeFolder = scopeFolder;
    }

    public RouteNode getRouteNode() {
        return routeNode;
    }

    public void setRouteNode(RouteNode routeNode) {
        this.routeNode = routeNode;
    }

}
